package com.zhuge_new.Activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhuge_new.Adapter.FragmentsAdapter;
import com.zhuge_new.Base.BaseActivity;
import com.zhuge_new.Fragment.DirectFragment;
import com.zhuge_new.R;
import com.zhuge_new.untils.ActivityStack;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lenovo on 2018-09-11.
 */

public class ManageActivity extends BaseActivity implements View.OnClickListener {

    private List<Fragment> listFragment=new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manage);
        init_title();

    }

    @Override
    public void init_title() {
        super.init_title();
        ImageView iv_back=findViewById(R.id.iv_nav_back);
        TextView tv_title=findViewById(R.id.tv_nav_title);
        tv_title.setText("客户管理信息");
        ViewPager mannge_viewpage=findViewById(R.id.mange_viewpage);
        
        TabLayout backcard_tab=findViewById(R.id.backcard_tab);


        /*DirectFragment directFragment1=new DirectFragment();
        Bundle directManager1=new Bundle();
        directManager1.putString("grade","2");
        directFragment1.setArguments(directManager1);
        listFragment.add(directFragment1);*/

        DirectFragment directFragment2=new DirectFragment();
        Bundle directManager2=new Bundle();
        directManager2.putString("grade","3");
        directFragment2.setArguments(directManager2);
        listFragment.add(directFragment2);

        DirectFragment directFragment3=new DirectFragment();
        Bundle directManager3=new Bundle();
        directManager3.putString("grade","4");
        directFragment3.setArguments(directManager3);
        listFragment.add(directFragment3);

        FragmentsAdapter fragmentsAdapter=new FragmentsAdapter(getSupportFragmentManager(),listFragment);
        mannge_viewpage.setAdapter(fragmentsAdapter);
        backcard_tab.setupWithViewPager(mannge_viewpage);

        backcard_tab.getTabAt(0).setText("推荐关系");
        /*backcard_tab.getTabAt(1).setText("代理关系");*/
        backcard_tab.getTabAt(1).setText("微客户关系");

        iv_back.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_nav_back:
                ActivityStack.getScreenManager().popOneActivity(ManageActivity.class);
                break;
        }
    }
}
